package com.mingqijia.gassafety.console.controller.bi;

import com.gap.basic.base.CommonResponse;
import com.mingqijia.gassafety.shared.utils.commonUtils.PageUtil;
import com.mingqijia.gassafety.webserver.request.bi.DeviceReportRequest;
import com.mingqijia.gassafety.webserver.request.bi.OneReportDetailRequest;
import com.mingqijia.gassafety.webserver.request.bi.OneReportRequest;
import com.mingqijia.gassafety.webserver.response.bi.DeviceReportListResponse;
import com.mingqijia.gassafety.webserver.response.bi.OneReportDetailResponse;
import com.mingqijia.gassafety.webserver.response.bi.DeviceReportResponse;
import com.mingqijia.gassafety.webserver.response.bi.OneReportResponse;
import com.mingqijia.gassafety.webserver.service.bi.DeviceReportStatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 设备上报情况报表
 * @author: duanhongxiang
 * @Desc:
 * @create: 2024-10-30 16:47
 **/
@Slf4j
@Api(tags = "设备上报情况报表")
@RestController(value = "DeviceReportStatController")
@RequestMapping("/business/v1/bi")
public class DeviceReportStatController {
    @Autowired
    DeviceReportStatService deviceReportStatService;

    @ApiOperation(value = "一次上报报表")
    @PostMapping("/one/report/list")
    public CommonResponse<OneReportResponse> oneReportList(@RequestBody OneReportRequest request) {
        return CommonResponse.success(deviceReportStatService.oneReportList(request));
    }

    @ApiOperation(value = "一次上报报表明细")
    @PostMapping("/one/report/detail")
    public CommonResponse<PageUtil<OneReportDetailResponse>> oneReportDetail(@RequestBody @Valid OneReportDetailRequest request) {
        return CommonResponse.success(deviceReportStatService.oneReportDetail(request));
    }

    @ApiOperation(value = "设备上报情况")
    @PostMapping("/device/report/condition")
    public CommonResponse<DeviceReportListResponse> deviceReport(@RequestBody @Valid DeviceReportRequest request) {
        return CommonResponse.success(deviceReportStatService.deviceReport(request));
    }
}
